package com.example.java;

import com.alibaba.fastjson2.JSONObject;
import com.xhf.tools.FileUtil;
import com.xhf.tools.JsonUtil;

import java.io.IOException;

public class StringTest {
    public static void main(String[] args) {

//        internTest();
        jsonReadTest("D:\\new 1.json");
    }
    public static void internTest(){
        String s1 = new StringBuilder("te").append("st").toString();
        System.out.println(System.identityHashCode(s1));
        System.out.println(System.identityHashCode(s1.intern()));
        System.out.println(System.identityHashCode("test"));
    }


    public static void jsonReadTest(String filePath){
        try {
            String jsonStr = FileUtil.readFile(filePath);
            JSONObject jsonObject = JsonUtil.parseObjec(jsonStr);
            System.out.println(jsonObject.toString());
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
